import Vue from 'vue';
import _ from 'lodash';
let gridAutosize = el => {
    let tableCt = el.parentNode;
    let tableHead = el.querySelector('.el-table__header-wrapper');
    let tableBody = el.querySelector('.el-table__body-wrapper');
    let bodyHeight = tableCt.clientHeight - tableHead.clientHeight-2;
    tableBody.style.height = bodyHeight + 'px';
    //debugger;
}
Vue.directive('grid-autosize', {
    inserted(el) {
        el.resizeHandler=_.debounce(gridAutosize.bind(null,el),150);
        window.addEventListener('resize',el.resizeHandler);
        el.resizeHandler();
    },
    unbind(el){
        window.removeEventListener('resize',el.resizeHandler);
    }
});